/*
 * Accelerometer.h
 *
 *  Created on: 2011. 3. 15.
 *      Author: JeeHoon
 */
#ifndef ACCELEROMETER_H
#define ACCELEROMETER_H

#include <FUix.h>
#include "Common.h"
#include "api/Plugin.h"

class PluginManager;

class Accelerometer :
	public Plugin,
	public Osp::Uix::ISensorEventListener
{
public:
	Accelerometer();
	~Accelerometer();

	/* Plugin */
	virtual result OnConstruct(PluginManager * pPluginManager, Osp::Base::String pluginName);
	virtual result execute(Osp::Base::String action, Osp::Base::String args, Osp::Base::String callbackId);

	/* Osp::Uix::ISensorEventListener */
	virtual void OnDataReceived (Osp::Uix::SensorType sensorType, Osp::Uix::SensorData &sensorData, result r);

private:
	bool 							__hasListener;
	long int 						__interval;
	long int 						__minInterval;
	long int 						__maxInterval;
	Osp::Uix::SensorManager *		__pSensorManager;
	result start(long int interval);
	result stop();
};

#endif //ACCELEROMETER_H
